﻿using System;
using System.Data;
using System.Configuration;
using System.Collections;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Web.UI.HtmlControls;
using System.Data.SqlClient;
public partial class wjTrade : System.Web.UI.Page
{
    public string Title;
    public string Keywords;
    public string Description;
    string strSQL, SQL;
    protected void Page_Load(object sender, EventArgs e)
    {
        if (!this.IsPostBack)
        {
            WebSiteInfo();
            zh_show();
            showli_hits();
            showli_news();
           
        }
    }
    public void WebSiteInfo()
    {
        DataTable dt = Class1.ExecSel("select WS_Title,WS_keywords,WS_description from Site_Config");
        this.Title = Convert.ToString(dt.Rows[0]["WS_Title"]);
        this.Keywords = Convert.ToString(dt.Rows[0]["WS_keywords"]);
        this.Description = Convert.ToString(dt.Rows[0]["WS_description"]);
    }

    public void showli_hits()
    {
        strSQL = "select top 10 n_ID, case when len(n_Title)>14 then left(n_Title,14)+'' else n_Title end as n_Title,n_Lock,n_HomeShow from ZhanHui where  n_Lock=0  order by n_Hits desc";
        IDataReader dr = Class1.GetDataReader(strSQL);
        while (dr.Read())
        {
            news_li_hits.Text += "<li>·<a href='wjShow_View_" + dr["n_ID"] + ".html' target=_blank>" + dr["n_Title"].ToString().Trim() + "</a></li>";
        }
    }
    public void showli_news()
    {
        strSQL = "select top 10 n_ID, case when len(n_Title)>14 then left(n_Title,14)+'' else n_Title end as n_Title,n_Lock,n_HomeShow from ZhanHui where  n_Lock=0 order by n_ID desc";
        IDataReader dr = Class1.GetDataReader(strSQL);
        while (dr.Read())
        {
            news_li_news.Text += "<li>·<a href='wjShow_View_" + dr["n_ID"] + ".html' target=_blank>" + dr["n_Title"].ToString().Trim() + "</a></li>";
        }
    }
    public void zh_show()
    {
        int ID = int.Parse(Request.QueryString["n_ID"]);
        if (ID != null)
        {
            SQL = "select * from ZhanHui where n_ID=" + ID;
            DataTable dt = Class1.ExecSel(SQL);
            zh_title.Text = dt.Rows[0]["n_Title"].ToString();
            zh_time.Text = dt.Rows[0]["n_Time"].ToString();
            zh_Source.Text = dt.Rows[0]["n_Source"].ToString();
            if (dt.Rows[0]["n_Img"].ToString() != "" && dt.Rows[0]["n_Img"].ToString() != null)
            {
                zh_img.Text = "<a href='#' target=_blank><img src=" + dt.Rows[0]["n_Img"].ToString().Trim() + " border=0 /></a>";
            }
            zh_content.Text = dt.Rows[0]["n_Content"].ToString();
            zh_class.Text = dt.Rows[0]["n_Class"].ToString();
            zh_hits.Text = dt.Rows[0]["n_Hits"].ToString();
            SQL = ("update ZhanHui set n_Hits=n_Hits+1 where n_ID=" + ID);
            Class1.ExecSql(SQL);
        }

    }
}
